package smedi.ismedi.mobile.bff.controller.constructionproject;

import com.smedi.ismedi.constructionproject.api.dto.response.BidSectionResponse;
import com.smedi.ismedi.constructionproject.api.feign.RemoteBidSectionFeignApi;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import smedi.ismedi.mobile.bff.controller.BaseController;

import java.util.List;

/**
 * 项目标段BFF
 *
 * @author Xulinjun
 */
@Slf4j
@RestController
@Api(tags = {"项目标段接口"})
@RequestMapping("/mobilebff/v1/bidSection")
@AllArgsConstructor
public class BidSectionController extends BaseController {
    private final RemoteBidSectionFeignApi remoteBidSectionFeignApi;

    /**
     * 根据项目id获取标段信息数组
     *
     * @param projectId
     * @return
     */
    @ApiOperation(httpMethod = "GET", value = "根据项目id获取标段信息数组")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "projectId", value = "项目id", dataType = "Long")
    })
    @GetMapping(value = "/getBidSectionList")
    public ResponseData<List<BidSectionResponse>> getBidSectionList(@RequestParam("projectId") Long projectId) {
        return remoteBidSectionFeignApi.getBidSectionList(projectId);
    }
}
